// 动态样式库

export function getQuickEntryStyles(config) {
  const style = config.style || {};
  return {
    quickEntryStyle: {
      margin: `${style.blockMargin || 0}px 0`,
      display: 'grid',
      gridTemplateColumns: `repeat(${config.itemsPerRow || 4}, 1fr)` ,
      gap: `${style.itemGap || 0}px`,
      background: '#fff',
      borderRadius: '12px',
      padding: '16px 0 8px 0',
      width: '95%',
      marginLeft: '.6rem',
      marginBottom: '12px',
      cursor: 'pointer',
      transition: 'all 0.3s ease'
    },
    entryItemStyle: {
      display: 'flex',
      flexDirection: 'column',
      alignItems: 'center'
    }
  };
}

export function getProductRecommendStyles(config) {
  const style = config.style || {};
  return {
    productRecommendStyle: {
      margin: `${style.blockMargin || 0}px 0`,
      background: '#fff',
      borderRadius: '12px',
      padding: '16px 0 20px 0',
      width: '95%',
      marginLeft: '.6rem',
      marginBottom: '16px'
    },
    gridStyle: (function() {
      if ((style.layoutType || config.layout) === 'list') {
        return { display: 'block' };
      }
      return {
        display: 'grid',
        gridTemplateColumns: '1fr 1fr',
        gap: `${style.itemGap || 12}px`
      };
    })(),
    layoutClass: (function() {
      const type = style.layoutType || config.layout || 'grid';
      if (type === 'list') return 'layout-list';
      if (type === 'staggered') return 'staggered';
      return 'layout-grid';
    })(),
    titleStyle: {
      fontSize: (style.fontSize ? style.fontSize + 2 : 16) + 'px',
      fontWeight: 500,
      marginBottom: '12px',
      marginLeft: '.7rem',
      color: style.textColor || '#222'
    },
    productCardStyle: (index) => {
      if ((style.layoutType || config.layout) === 'staggered') {
        return {
          width: '92%',
          marginLeft: '.7rem',
          borderRadius: '10px',
          height: '14rem',
          marginTop: index % 2 === 1 ? '30px' : '0'
        };
      }
      return {
        width: '92%',
        marginLeft: '.7rem',
        borderRadius: '10px',
        height: '14rem'
      };
    }
  };
} 